home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / Unmangler.p < prev    next >
Encoding:
Text File  |  1996-09-18  |  2.8 KB  |  78 lines  |  [TEXT/MPS ]

  1. (*---------------------------------------------------------------------------*
  2.  |                                                                           |
  3.  |                            <<< Unmangler.p >>>                            |
  4.  |                                                                           |
  5.  |                         C++ Function Name Decoding                        |
  6.  |                                                                           |
  7.  |                 Copyright Apple Computer, Inc. 1988-1995                  |
  8.  |                           All rights reserved.                            |
  9.  |                                                                           |
  10.  *---------------------------------------------------------------------------*)
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17. UNIT Unmangler;
  18.  INTERFACE
  19. {$ENDC}
  20.         
  21. {$IFC UNDEFINED UsingUnmangler AND UNDEFINED __UNMANGLER__}
  22. {$SETC UsingUnmangler := 1}
  23. {$SETC __UNMANGLER__ := 1}
  24. {$I+}
  25. {$SETC UnmanglerIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27.  
  28. {$IFC UNDEFINED UsingTypes AND UNDEFINED __TYPES__}
  29. {$I Types.p}
  30. {$ENDC}
  31.  
  32. {$SETC UsingIncludes := UnmanglerIncludes}
  33.  
  34.         (*
  35.         FUNCTION unmangle(dst: UNIV Ptr; src: UNIV Ptr; limit: LongInt): LongInt; C;
  36.             {This function unmangles C++ mangled symbols (i.e. a symbol with a type signature).
  37.              The mangled C string is passed in “src” and the unmangled C string is returned in
  38.              “dst”.  Up to “limit” characters (not including terminating null) may be returned
  39.              in “dst”.
  40.          
  41.              The function returns,
  42.          
  43.                  -1 ==> error, probably because symbol was not mangled, but looked like it was
  44.                     0 ==> symbol wasn't mangled; not copied either
  45.                     1 ==> symbol was mangled; unmangled result fit in buffer
  46.                     2 ==> symbol was mangled; unmangled result truncated to fit in buffer}
  47.         *)
  48.         
  49. {$IFC UNDEFINED __CFM68K__}
  50.     {$PUSH}
  51.     {$LibExport+}
  52. {$ENDC}
  53.         FUNCTION Unmangle(dst: UNIV StringPtr; src: UNIV StringPtr; limit: LongInt): LongInt;
  54.             {This function unmangles C++ mangled symbols (i.e. a symbol with a type signature).
  55.              The mangled Pascal string is passed in “src” and the unmangled Pascal string is
  56.              returned in “dst”.  Up to “limit” characters may be returned in “dst”.
  57.             
  58.              The function returns,
  59.              
  60.                  -1 ==> error, probably because symbol was not mangled, but looked like it was
  61.                     0 ==> symbol wasn't mangled; not copied either
  62.                     1 ==> symbol was mangled; unmangled result fit in buffer
  63.                     2 ==> symbol was mangled; unmangled result truncated to fit in buffer
  64.                      
  65.              This function is identical to unmangle() above except that all the strings are
  66.              Pascal instead of C strings.
  67.             }
  68.  
  69. {$IFC UNDEFINED __CFM68K__}
  70.     {$POP}
  71. {$ENDC}
  72.  
  73. {$ENDC} { UsingUnmangler }
  74.  
  75. {$IFC NOT UsingIncludes}
  76.  END.
  77. {$ENDC}
  78.